/**
 * 任务操作
 */

import  store from 'vuex';

import taskeReq from "@/api/task.js";

import * as types from '../mutation-types'

const task={
  state:{

  },
  mutations:{

  },
  actions:{
    getMyTask({commit,state,rootState},{token, searchParams}){

      rootState.loading=!rootState.loading;

      return new Promise((resolve,reject)=>{

        taskeReq.doGetMyTask(token, searchParams).then(res =>{

          resolve(res);

          rootState.loading=!rootState.loading;

        },res => {

          reject(res);

          rootState.loading=!rootState.loading;

        }).catch(err => {

          reject(err);

          rootState.loading=!rootState.loading;

        });

      });

    }
  }
}

export default task;
